package classifiers.helper;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;

import weka.core.Instance;
import weka.core.Instances;
import weka.core.WekaEnumeration;


public class BinaryRelevanceTransformationInstances extends Instances {

	private Instances data;
	private Instances dataset;
	private int label_idx;
	
	private List<Instance> instances;
	
	public BinaryRelevanceTransformationInstances(int label_idx,Instances data,Instances dataset) {
		super(new Instances(dataset,0,1));
		this.dataset = new Instances(dataset,0,1);
		this.data = data;
		this.label_idx = label_idx;
		instances = new ArrayList<Instance>(data.numInstances());
		for ( int i = 0 ; i < data.numInstances() ; ++i ) {
			instances.add(new BinaryRelevanceTransformationInstance(label_idx,data.get(i),dataset));
		}
	}
	
	@Override
	public Instance get(int index) {
		return instances.get(index);
	}
	
	@Override
	public Instance instance(int index) {
		return instances.get(index);
	}
	
	@Override
	public int numInstances() {
		return data.numInstances();
	}
	
	@Override
	public Enumeration enumerateInstances() {
		return new WekaEnumeration(instances);
	}

}
